package com.xja.controller;

import com.xja.model.entity.Model;
import com.xja.model.vo.resp.Result;
import com.xja.service.IModelService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author 蔡建国
 * Date  2025/6/11 10:27
 */
@RestController
@Slf4j
@RequiredArgsConstructor
@Tag(name = "模型管理")
@RequestMapping("/admin/model")
public class AdminModelController {

    private final IModelService modelService;

    @GetMapping("/list")
    @Operation(summary = "获取模型列表")
    public Result<List<Model>> list() {
        List<Model> modelList = modelService.list();
        return Result.success(modelList);
    }

    @PutMapping
    @Operation(summary = "更新模型")
    public Result<Void> update(@RequestBody Model model) {
        modelService.updateById(model);
        return Result.success();
    }
}